package com.miplus.ccrm.core.service.collect;

import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.miplus.ccrm.common.CmdResVo;
import com.miplus.ccrm.common.JPubUtils;
import com.miplus.ccrm.core.pojo.FiNavigateSet;
import com.miplus.ccrm.core.mapper.FiNavigateSetMapper;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
* @author pc
* @description 针对表【FI_NAVIGATE_SET(案件导航设置)】的数据库操作Service实现
* @createDate 2024-12-14 20:20:54
*/
@Service
public class FiNavigateSetServiceImpl extends MPJBaseServiceImpl<FiNavigateSetMapper, FiNavigateSet>
    implements FiNavigateSetService{

    @Override
    public List<String> getNavigateList(String usrid)
    {
        return selectJoinList(String.class,new MPJLambdaWrapper<FiNavigateSet>()
                .eq(FiNavigateSet::getUsrid,usrid)
                .select(FiNavigateSet::getMthsoude)
        );
    }

    @Override
    public CmdResVo setNavigateList(String usrid, List<String> mthsOdues)
    {
        int ret=baseMapper.delete(new MPJLambdaWrapper<FiNavigateSet>()
                .eq(FiNavigateSet::getUsrid,usrid));

        if(JPubUtils.IsNotEmpty(mthsOdues)){
            for(String m : mthsOdues){
                FiNavigateSet p=new FiNavigateSet();
                p.setUsrid(usrid);
                p.setMthsoude(m);
                p.setUpdt(new Date());
                p.setUpusr(usrid);
                baseMapper.insert(p);
            }
        }

        return new CmdResVo(ret);
    }
}




